package com.vtech.ws.cxf.service.impl;

import com.vtech.ws.cxf.entity.Greeting;
import com.vtech.ws.cxf.service.CxfService;
import org.springframework.stereotype.Service;

import javax.jws.WebService;
import java.util.Calendar;
import java.util.Date;

/**
 * TODO
 * 可以不用写@WebService内容,由cxf自动判断？
 * @author houzhiwei
 * @date 2018/7/22 16:28
 */

@WebService(
        endpointInterface = "com.vtech.ws.cxf.service.CxfService", // 接口名
        targetNamespace = "http://cxf.ws.vtech.com", // 同 接口类
        serviceName = "hiService" // 同 接口类中的 name
)
@Service
public class CxfServiceImpl implements CxfService {
    @Override
    public String sayHi(String hi) {
        return "Hello " + hi + ", currentTime is "
                + Calendar.getInstance().getTime();
    }

    @Override
    public Greeting sayBye(String name) {
        Greeting greeting = new Greeting();
        greeting.setMessage("Bye " + name + "!!!");
        greeting.setDate(new Date());
        return greeting;
    }
}
